home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / LiveFastStartServer / Open Transport 1.3 / Includes / CIncludes / OpenTptGlobalNew.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-30  |  1.0 KB  |  62 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        OpenTptGlobalNew.h
  3.  
  4.     Contains:    Definition of "new" operator that uses Open Transport's
  5.                 OTAllocMem and OTFreeMem functions.
  6.  
  7.     Copyright:    © 1994-1996 by Apple Computer, Inc., all rights reserved.
  8.  
  9.  
  10. */
  11.  
  12. #ifndef __OPENTPTGLOBALNEW__
  13. #define __OPENTPTGLOBALNEW__
  14.  
  15. #ifndef SystemSevenOrLater
  16. #define SystemSevenOrLater    1
  17. #endif
  18.  
  19. #ifndef __CONDITIONALMACROS__
  20. #include <ConditionalMacros.h>
  21. #endif
  22. #ifndef __STDDEF__
  23. #include <StdDef.h>
  24. #endif
  25.  
  26. #if GENERATING68K && defined(__MWERKS__)
  27. #pragma pointers_in_D0
  28. #endif
  29. #if PRAGMA_IMPORT_SUPPORTED
  30. #pragma import on
  31. #endif
  32.  
  33. extern "C" 
  34. {
  35.     void*     OTAllocMem(size_t);
  36.     void    OTFreeMem(void*);
  37. }
  38.  
  39. #if PRAGMA_IMPORT_SUPPORTED
  40. #pragma import off
  41. #endif
  42. #if GENERATING68K && defined(__MWERKS__)
  43. #pragma pointers_in_A0
  44. #endif
  45.  
  46. inline void* operator new(size_t size)
  47. {
  48.     return OTAllocMem(size);
  49. }
  50.  
  51. inline void* operator new(size_t size, size_t extra)
  52. {
  53.     return OTAllocMem(size + extra);
  54. }
  55.  
  56. inline void operator delete(void* theMem)
  57. {
  58.     OTFreeMem(theMem);
  59. }
  60.     
  61. #endif    /* __OPENTPTGLOBALNEW__ */
  62.